package com.example.produces.service.impl;

import com.example.produces.entity.Client;
import com.example.produces.mapper.ClientMapper;
import com.example.produces.service.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
//对server接口里面的方法进行重写，并调用mapper接口
public class ClientImpl implements ClientService {
    @Autowired//@Autowired注解的required参数默认是true，表示开启自动装配，有些时候我们不想使用自动装配功能，可以将该参数设置成false。
    private ClientMapper clientMapper;

    @Override
    public List<Client> findAll(){
        List<Client>clients=clientMapper.findAll();
        return clients;
    }

    @Override
    public void Add(Client client) {
        clientMapper.Add(client);
    }

    @Override
    public Client findOne(String name) {
        Client client=clientMapper.findOne(name);

        return client;
    }

    @Override
    public void upDate(Client client) {
        clientMapper.upDate(client);
    }

}
